
angular.module('imsApp').factory('AuthManager', ['$http','api', function ($http,api) {
  var AuthManager = {
    /**
     * 用户登陆
     * @params json
     * eg:
     * {
         *     userName: 'XXXX',
         *     password: 'XXXX'
         * }
     * @return json
     */
    login: function (params) {
      return $http.post(api+'/web_ims/login/login.do', params).then(function (result) {
        return result;
      });
    },
    /**
     * 用户退出
     * @params json
     * eg:
     * {
         *     token: 'XXXX',
         * }
     * @return json
     */
    loginOut: function (params) {
      return $http.post(api+'/web_ims/login/logout.do', params).then(function (result) {
        return result;
      });
    },
    /**
     * 修改密码
     * @params json
     * eg:
     * {
         *     oldPsw: 'XXXX',
         *     newPsw: 'XXXX'
         * }
     * @return json
     */
    resetPassword: function (params) {
      return $http.put('/ims/changePsw.do', params).then(function (result) {
        return result;
      });
    },
  };
 



  return AuthManager;
}]);
